﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace EzDesk.Attendance.AttendanceImpl
{
    public class SimpleTime
    {
        public int Hour { get; set; }
        public int Miniute { get; set; }
        public DateTime ToDateTime(DateTime date)
        {
             return new DateTime(
                date.Year,
                date.Month,
                date.Day,
                Hour,
                Miniute,
                0
                );
        }

        public DateTime ToDateTime()
        {
            return ToDateTime(DateTime.Today);
        }
    }

    public class AttendanceConfig
    {
        private AttendanceConfig() { }

        public static readonly AttendanceConfig Cfg = new AttendanceConfig();

        /// <summary>
        /// 参与考勤的用户Id列表
        /// </summary>
        public string AttendanceUserIds
        {
            get
            {
                //"karin,gw,yuxin"
                return "877c3323-17a7-42d1-9d75-402ffc894e63,19f1c421-280f-4935-9980-e469175461c2,0c9d7c0c-04a5-4ae2-97a1-d7bbc38f5c66";
            }
        }

        /// <summary>
        /// 参与考勤管理的用户Id列表
        /// </summary>
        public string AttendanceManagerUserIds
        {
            get
            {
                //"yuxin"
                return "0c9d7c0c-04a5-4ae2-97a1-d7bbc38f5c66";
            }
        }


        /// <summary>
        /// 上班考勤通知模板Id
        /// </summary>
        public string OnDutyNotifyTemplateId
        {
            get
            {
                return "f81cc3a8-c499-4c91-9cf8-d871e5e69970";
            }
        }

        /// <summary>
        /// 今日考勤报告模板Id
        /// </summary>
        public string AttendanceTodayReportTemplateId
        {
            get
            {
                return "0ac05442-9963-494e-90d7-c89aaea89e33";
            }
        }

        /// <summary>
        /// 新考勤记录的模板Id
        /// </summary>
        public string NewAttendanceUpdateTemplateId
        {
            get
            {
                return "a57e5e48-4253-4b83-9a29-b780c326e87e";
            }
        }

        /// <summary>
        /// 标准上班时间
        /// </summary>
        public SimpleTime StdOnDutyTime
        {
            get
            {
                return new SimpleTime() { Hour = 9, Miniute = 0 };
            }
        }

        /// <summary>
        /// 标准上班提前时间
        /// </summary>
        public int AdvanceOnDuty
        {
            get
            {
                return 30;
            }
        }


        /// <summary>
        /// 标准下班时间
        /// </summary>
        public SimpleTime StdOffDutyTime
        {
            get
            {
                return new SimpleTime() { Hour = 18, Miniute = 0 };
            }
        }

        /// <summary>
        /// 标准下班提前时间
        /// </summary>
        public TimeSpan AdvanceOffDuty
        {
            get
            {
                return TimeSpan.FromMinutes(30);
            }
        }


        /// <summary>
        /// 是否通知上班考勤
        /// </summary>
        public bool HasOnDutyNotification
        {
            get
            {
                return true;
            }
        }
        /// <summary>
        /// 上班考勤通知提前时间
        /// </summary>
        public TimeSpan OnDutyNotifyAdvance
        {
            get { return TimeSpan.FromMinutes(30); }
        }


        /// <summary>
        /// 是否在考勤后通知考勤信息
        /// </summary>
        public bool HasAfterDutyNotification
        {
            get
            {
                return true;
            }
        }

        /// <summary>
        /// 考勤后通知的延后时间
        /// </summary>
        public TimeSpan AfterDutyDely
        {
            get { return TimeSpan.FromMinutes(60); }
        }

    }
}
